package wsi.gui.resolve.model;

import java.io.File;

import org.rygh.gui.comp.TreeNode;

import wsi.exp.ExpFolderController;
import wsi.script.AppConfig;

public class FunctionTreeNode extends TreeNode<String> {

	public static FunctionTreeNode build() {
		File dir = ExpFolderController.shared().getFolderForExp5();
		AppConfig ac = AppConfig.shared();

		String name = ac.getRunsFolder().getName();

		FunctionTreeNode root = new FunctionTreeNode(name);
		root.setExpanded(true);

		FunctionTreeNode folder;

		for (File d : dir.listFiles()) {
			if (!d.isDirectory())
				continue;

			folder = new FunctionTreeNode(d.getName());
			root.addChild(folder);

		}

		return root;
	}

	private FunctionTreeNode(String item) {
		super(item);
	}

}
